package com.infindo.appcreate.zzyj.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.infindo.appcreate.zzyj.util.DateTimeUtil;

@Entity
@Table(name = "zzyj_project_comment", schema = "public")
public class ProjectComment implements java.io.Serializable {

    private static final long serialVersionUID = 4078996767329716910L;
    private Long id;
    private String projectCode;
    private String expertCode;
    private Date time;      
    private String desc;
    private Integer type;//0 expert; 1 public
    private String image;//
    private String authIcon;
    private String nickName;
    
    private String timeF;//format time item
    
    public ProjectComment(){}
    
    public ProjectComment(String projectCode, String expertCode, Date time, String desc, Integer type, String image, String authIcon, String nickName){
        super();
        this.projectCode = projectCode;
        this.expertCode = expertCode;
        this.time = time;
        this.desc = desc;
        this.type = type;
        this.image = image;
        this.authIcon = authIcon;
        this.nickName = nickName;
    }

	@SequenceGenerator(name = "generator", sequenceName = "seq_zzyj_project_comment",allocationSize=1)
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "project_code")
    public String getProjectCode() {
        return projectCode;
    }
    public void setProjectCode(String projectCode) {
        this.projectCode = projectCode;
    }
    
    @Column(name = "expert_code")
    public String getExpertCode() {
        return expertCode;
    }
    public void setExpertCode(String expertCode) {
        this.expertCode = expertCode;
    }
    
    @Column(name = "time")
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }
    
    @Column(name = "_desc")
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }

    @Column(name = "image")
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }

    @Column(name = "auth_icon")
    public String getAuthIcon() {
        return authIcon;
    }
    public void setAuthIcon(String authIcon) {
        this.authIcon = authIcon;
    }

    @Column(name = "nick_name")
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    
    @Transient
  	public String getTimeF() {
      	if(null != this.time){
      		return DateTimeUtil.DateToString("yyyy.MM.dd", this.time);
      	}
  		return null;
  	}
  	public void setTimeF(String timeF) {
  		this.timeF = timeF;
  	}
	
}
